Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

667
Visualizações
Spring Boot app in Docker receives: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

I have a Spring Boot app in Docker that runs on Heroku.

Recently, after updating Tomcat to 10.1.0-M10, I started getting this error:

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

The immediate thought of downgrading to lower versions doesn't work due to vulnerabilities in the earlier versions. I have checked possible causes and found Tomcat binding port issue.

I cannot set up fixed config for different ports as I am deploying to Heroku and dependent on their random ports.

My Dockerfile:

FROM azul/zulu-openjdk-alpine:11
ENV PORT=$PORT
COPY /target/app.jar /app.jar
CMD java -Xms256m -Xmx512m \
    -Dlog4j2.formatMsgNoLookups=true \
    -Djava.security.egd=file:/dev/./urandom \
    -Dserver.port=$PORT \
    -jar /app.jar

What is the way to solve it? Is there anything I am missing?

UPDATE:

There are more logs from Heroku:

Feb 22 12:50:16 integration-test app/web.1 2022-02-22 20:50:16.057 [main] INFO  c.g.s.z.ApplicationKt - Started ApplicationKt in 8.09 seconds (JVM running for 9.062)
Feb 22 12:50:16 integration-test app/web.1 2022-02-22 20:50:16.060 [main] DEBUG o.s.b.a.ApplicationAvailabilityBean - Application availability state LivenessState changed to CORRECT
Feb 22 12:50:16 integration-test app/web.1 2022-02-22 20:50:16.063 [main] DEBUG o.s.b.a.ApplicationAvailabilityBean - Application availability state ReadinessState changed to ACCEPTING_TRAFFIC
Feb 22 12:51:06 integration-test heroku/web.1 Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

I found a solution that wasn't perfect but seemed to work for me.

  • Downgraded Spring Boot from 2.6.3 to 2.6.1
  • Downgraded Tomcat from 10.X.X to 9.X.X
  • Removed dev tools dependencies

I think the two latest did the magic. Dev tools stopped asking for an extra port in the test/prod environment. Tomcat bound the port in the version 9.X.X but not in 10.X.X.

Even though I found the solution, I don't know why it behaved like this, and it isn't perfect security-wise.

over 4 years ago · Santiago Trujillo Relatório

0

from the error message it seems that $PORT is not resolved to any environment variable.

deploying to heroku you must use .env file to define env vars (you can't use docker run -e PORT=1234) see documentation

When you use heroku locally, you can set config vars in a .env file. When heroku local is run .env is read and each name/value pair is set in the environment. You can use this same .env file when using Docker: docker run -p 5000:5000 --env-file .env <image-name>

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda